// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import 'element-ui/lib/theme-chalk/display.css';
Vue.use(ElementUI);

import 'c-swipe/dist/swipe.css';
import {Swipe, SwipeItem} from 'c-swipe';

Vue.component('swipe', Swipe);
Vue.component('swipe-item', SwipeItem);

Vue.config.productionTip = false
import qs from 'qs'

Vue.prototype.$qs = qs
import axios from 'axios'

Vue.prototype.$axios = axios
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.baseURL = process.env.NODE_ENV === 'production' ? "http://101.34.80.225:8082/" : '/api'
// axios.defaults.baseURL =  process.env.NODE_ENV === 'production' ? "" : '/api'
import waterfall from 'vue-waterfall2'

Vue.use(waterfall)
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
router.beforeEach((to, from, next) => {
  // 统计代码
  // if(to.path == '/product' || to.path == '/solution'){
  //   _hmt.push(['_trackPageview', to.fullPath]);
  // }
  document.body.scrollTop = 0
  // firefox
  document.documentElement.scrollTop = 0
  // safari
  window.pageYOffset = 0
  next();
});
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
});

